package br.com.mundoj.subscription.client;

import java.sql.Date;

import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class Person {
	public enum Gender {
		MALE, FEMALE
	}
	
	private @Id String document;
	private Type type;
	
	private String name, email;
	
	private Gender gender;
	private Date birthDate;
	
	private Address address;
	private ContactData contacts;
	
	public String getDocument() {
		return document;
	}
	public void setDocument(String document) {
		this.document = document;
	}
	
	public Type getType() {
		return type;
	}
	public void setType(Type type) {
		this.type = type;
		if (type==Type.LEGAL_ENTITY) {
			gender = null;
			birthDate = null;
		}
	}
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	
	public Gender getGender() {
		return gender;
	}
	public void setGender(Gender gender) {
		this.gender = gender;
	}
	
	public Date getBirthDate() {
		return birthDate;
	}
	public void setBirthDate(Date birthDate) {
		this.birthDate = birthDate;
	}
	
	public Address getAddress() {
		if (address==null)
			address = new Address();
		return address;
	}
	public void setAddress(Address address) {
		this.address = address;
	}
	
	public ContactData getContacts() {
		if (contacts==null)
			contacts = new ContactData();
		return contacts;
	}
	public void setContacts(ContactData contacts) {
		this.contacts = contacts;
	}
}